﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DataAccess_Layer;
using DTO;
namespace Business_Layer
{
    public class NhaCungCapBUS
    {
        NhaCungCapDAC ncc = new NhaCungCapDAC();
        public int GetListAllByUser(string tendangnhap)
        {
            try
            {
                return ncc.GetListAllByUser(tendangnhap);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public IList<NhaCungCapDTO> GetList(string tendn, string pass)
        {
            try
            {
                return ncc.GetList(tendn,pass);
            }
            catch(Exception e)
            {
                throw e;
            }
        }
        public IList<NhaCungCapDTO> GetList(string tendn)
        {
            try
            {
                return ncc.GetList(tendn);
            }
            catch (Exception e)
            {
                throw e;
            }
        }
        public int GetListAllByTenNCC(string tenncc)
        {
            try
            {
                return ncc.GetListAllTenncc(tenncc);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public int GetListAllBySoTK1(string sotk1)
        {
            try
            {
                return ncc.GetListAllBySoTK1(sotk1);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public int GetListAllBySoTK2(string sotk2)
        {
            try
            {
                return ncc.GetListAllBySoTK2(sotk2);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public int GetListAllBySodt(string sodt)
        {
            try
            {
                return ncc.GetListAllBySodt(sodt);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public bool updateSuppler(NhaCungCapDTO nc)
        {
            try
            {
                ncc.updateSupper(nc);
                return true;
            }
            catch
            {
                return false;
            }
        }

        public int InsertSupplier(NhaCungCap nc)
        {
            try
            {
                ncc.InsertSupplier(nc);
                return 1;
            }
            catch
            {
                return 0;
            }
        }
        public int GetListAll(string tendangnhap, string pass)
        {
            try
            {
                return ncc.GetListAll(tendangnhap,pass);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static bool kiemTraDangNhap(string tenDangNhap, string matKhau)
        {
            return NhaCungCapDAC.kiemTraDangNhap(tenDangNhap, matKhau);
        }
    }
    
}
